-----------------------------------------------------------------------------------------------------------------------------------------------------
Testing your code inside Docker

$ wget -qO- https://bootstrap.pypa.io/get-pip.py | sudo python3 -

$ python3 -m unittest

$ touch hitcount.py

$ python3 -m unittest

$ sudo pip3 install redis

$ sudo pip3 install mockredispy

$ python3 -m unittest
-----------------------------------------------------------------------------------------------------------------------------------------------------
Running the test inside a container

$ sudo docker build -t hit_unittest .

$ sudo docker run --rm -it hit_unittest .
-----------------------------------------------------------------------------------------------------------------------------------------------------
Using a Docker container as a runtime environment

$ sudo docker run -it \
-v /home/peter/src/hitcount:/src \
python:latest /bin/bash

root@a8219ac7ed8e:~# cd /src
root@a8219ac7ed8e:/src# python3 -m unittest


root@a8219ac7ed8e:/src# pip install mockredispy

root@a8219ac7ed8e:/src# python3 -m unittest

root@a8219ac7ed8e:/src# pip install redis

root@a8219ac7ed8e:/src# python3 -m unittest

$ sudo docker commit a8219ac7ed8e python_rediswithmock
-----------------------------------------------------------------------------------------------------------------------------------------------------
Integrating Docker testing into Jenkins

$ wget -q -O - \
https://jenkins-ci.org/debian/jenkins-ci.org.key | \
sudo apt-key add -

$ sudo sh -c \
'echo deb http://pkg.jenkins-ci.org/debian binary/ > \
/etc/apt/sources.list.d/jenkins.list'

$ sudo apt-get update

$ sudo apt-get install jenkins

$ sudo service jenkins start

$ sudo apt-get install git

$ sudo gpasswd -a jenkins docker

$ sudo service jenkins restart
-----------------------------------------------------------------------------------------------------------------------------------------------------
Automating the Docker testing process

docker build -t docker_testing_using_jenkins .
docker run --rm docker_testing_using_jenkins 
-----------------------------------------------------------------------------------------------------------------------------------------------------